package com.it.mybytestream2;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class ByteStreamDemo3 {
    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        //创建对象
        FileInputStream fis = new FileInputStream("D:\\图集\\OIP-C (1).jpg");
        FileOutputStream fos = new FileOutputStream("D:\\java\\basic-code\\myio\\src\\视频.txt");
        //边读边写
        int len;
        byte[] bytes = new byte[1024*1024*5];
        while((len = fis.read(bytes)) != -1){
            fos.write(bytes,0,len);
        }
        //释放资源
        fos.close();
        fis.close();

        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }
}
